-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Migrating Foundation to Swift 3 #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
if pwd != nil && pwd.pointee.pw_name != nil { | ||
let name = String(cString: pwd.pointee.pw_name) | ||
result[NSFileOwnerAccountName] = name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this logic changed? couldn't a string from c potentially be corrupted? I have seen that type of failure in C before why can't it happen here? Is this perhaps the wrong API to call if we want a failable C string conversion (without bouncing to CFStringRef/NSString, which can handle a failable conversion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we're trying to avoid static factory methods and replace them with initializers. This particular initializer (init(cString:)
) will try to repair ill-formed code units, which, we believe, is the behavior one would prefer by default (as opposed to the failing one). If you do prefer it to fail -- there is String.init?(validatingUTF8:)
.
Please note though, that both initializers will trap on nil.
What is the error you are running into? Is it a compilation failure or runtime? |
@swift-ci Please test |
033005f
to
7334e70
Compare
Rebased on top of current master to fix merge conflicts. |
Thanks, we have gotten a bit behind in our PRs. Overall the changes look like they applied just fine so far. Is this blocked on any specific swift or XCTest PRs? |
I tried to reproduce the compilation error I mentioned above this morning, but it just wasn't there. Right now I'm migrating XCTest, after which will migrate Foundation tests and update this PR. |
@phausler made tests compile after migrating XCTest. |
@moiseev can you run that with lldb and get me a backtrace? is that the only failure if you just disable that test? |
I was going to do just that, haven't got time yet. Will try tomorrow morning. |
22f67cc
to
521a7be
Compare
Ok. So, I've commented out the |
Good with me. |
yea, all looks good. Filed https://bugs.swift.org/browse/SR-878 to follow up on the test_xpath issue; probably would be a decent starter bug too since it would start off with just uncommenting and debugging. |
521a7be
to
354fa65
Compare
Migrating Foundation to Swift 3
@phausler that was a bit too early, Swift master is not Swift 3 yet, neither is XCTest. Could you please revert this one? |
ok sorry bout that, I thought we were good to go on this. |
Thanks. I will send a new PR when we are actually ready.
|
Rebased. Fixed. Tested. Ready for merge now. |
Oops. Commented here instead of #281. |
[vscode-extension] Run 'npm audit fix'
[pull] swiftwasm from main
This branch is a result of running migrator on master and polishing it manually until it compiled on Linux.
Attempt to compile tests results in a weird error that needs further investigation.